<?php

namespace App\Models\Arts;

use App\Models\BaseModel;
use App\Utils\Common;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class UserThirdModel extends BaseModel
{
    use HasFactory;

    protected $table = 'user_third';
    public $timestamps = false;
    protected int $is_status_search = 0;// 默认使用 status = 1 筛选
    protected int $is_delete_search = 0;// 默认使用 is_delete = 0 筛选

    /**
     * 默认查询字段
     *
     * @var array|string[]
     */
    public array $select = ['*'];

    public function searchUserIdAttribute($query, $value, array $params): mixed
    {
        return $query->where('user_id', $value);
    }

    public function searchPlatformAttribute($query, $value, array $params): mixed
    {
        return $query->where('platform', $value);
    }

    public function searchOpenidAttribute($query, $value, array $params): mixed
    {
        return $query->where('openid', $value);
    }

    public function searchUnionidAttribute($query, $value, array $params): mixed
    {
        return $query->where('unionid', $value);
    }
}
